﻿@page "/pivot-table/local-data"

@using Syncfusion.Blazor.PivotView
@inherits SampleBaseComponent;
@using BlazorDemos
@using ej2_blazor_groupdata

    <div class="control-section">
        <div class="content-wrapper">
            <SfPivotView TValue="GroupData" Width="100%" Height="340" EnableValueSorting=true ShowTooltip=false>
                <PivotViewDataSourceSettings DataSource="@DataSource" ExpandAll=true EnableSorting=true>
                    <PivotViewColumns>
                        <PivotViewColumn Name="EnerType" Caption="Energy Type"></PivotViewColumn>
                        <PivotViewColumn Name="EneSource" Caption="Energy Source"></PivotViewColumn>
                    </PivotViewColumns>
                    <PivotViewRows>
                        <PivotViewRow Name="Year" Caption="Production Year"></PivotViewRow>
                        <PivotViewRow Name="HalfYear" Caption="Half Year"></PivotViewRow>
                    </PivotViewRows>
                    <PivotViewValues>
                        <PivotViewValue Name="PowUnits" Caption="Units (GWh)"></PivotViewValue>
                        <PivotViewValue Name="ProCost" Caption="Cost (MM)"></PivotViewValue>
                    </PivotViewValues>
                    <PivotViewFormatSettings>
                        <PivotViewFormatSetting Name="ProCost" Format="C0" UseGrouping=true></PivotViewFormatSetting>
                    </PivotViewFormatSettings>
                </PivotViewDataSourceSettings>
                <PivotViewGridSettings ColumnWidth="140"></PivotViewGridSettings>
            </SfPivotView>
        </div>
    </div>

<style>
    .e-pivotview {
        min-height: 200px;
    }
</style>

@code{
    public string[] Grouping = new string[] { "Years", "Months", "Days" };
    public List<GroupData> DataSource { get; set; }
    protected override void OnInitialized()
    {
        this.DataSource = GroupData.GetGroupData();
    }


}